import request from '@/utils/request'

// 获取业务类型列表
export const getBusinessTypes = (params) => {
  return request({
    url: '/business-types',
    method: 'get',
    params
  })
}

// 获取所有启用的业务类型（用于下拉选择）
export const getActiveBusinessTypes = () => {
  return request({
    url: '/business-types/active',
    method: 'get'
  })
}

// 获取业务类型详情
export const getBusinessType = (id) => {
  return request({
    url: `/business-types/${id}`,
    method: 'get'
  })
}

// 创建业务类型
export const createBusinessType = (data) => {
  return request({
    url: '/business-types',
    method: 'post',
    data
  })
}

// 更新业务类型
export const updateBusinessType = (id, data) => {
  return request({
    url: `/business-types/${id}`,
    method: 'put',
    data
  })
}

// 删除业务类型
export const deleteBusinessType = (id) => {
  return request({
    url: `/business-types/${id}`,
    method: 'delete'
  })
}

// 启用/禁用业务类型
export const toggleBusinessTypeStatus = (id, isActive) => {
  return request({
    url: `/business-types/${id}/status`,
    method: 'patch',
    data: { isActive }
  })
} 